<template>
	<view class="xb-page">
		<view class="xb-textbutton-cell">
			<view @click="addroom" class="xb-textbutton  page-button-right">添加新教室</view>
		</view>
		<view class="xb-list">
			<view class="xb-list-cell" v-for="(room,index) in roomlist" :key="index">
				<view class="xb-list-cell-navigate">
					{{room.name}}
				</view>
			</view>

		</view>
	</view>
</template>

<script>
	import pageHead from '../../../components/page-head.vue';
	export default {
		data: {
			formdata: {
				pageno: 1,
				pagesize: 10
			},
			roomlist: [{
					name: '小班'
				},
				{
					name: '大班'
				}
			]
		},

		onLoad: function() {
			initData();
		},
		onPullDownRefresh: function() {
			initData();
		},
		methods: {
			addroom:function(){
				uni.navigateTo({
					url:'addRoom'
				})
			},
			initData: async function() {
				uni.showNavigationBarLoading();
				let data = formData;
				const res = await roomList(formdata);
				if (res.success == true) {
					uni.hideNavigationBarLoading();
					this.roomlist.push(res.data.values);
				} else {
					uni.hideNavigationBarLoading();

				}






			}
		}
	};
</script>

<style scoped>
	@import '../../../common/uni.css';
	@import '../../../common/xb.css';

	.page-button-right {
		position: absolute;
		right: 3%;
		top: 30%;
	}
</style>
